<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* 相对定位不会脱离文档流,只会比其他普通元素的层级高一点 */
      div {
        border: 1px solid black;
      }
      .box1 {
        position: relative;
        /* top: 20px; */
        background-color: antiquewhite;
      }
      .box2 {
        background-color: red;
      }
    </style>
  </head>
  <body>
    <div class="box1">盒子1</div>
    <div class="box2">盒子2</div>
  </body>
</html>
